//
//  RPCCallback.cpp
//  tarsim
//
//  Created by lanhy on 2022/3/22.
//

#include "RPCCallback.h"
#include "log.h"
#include "LonglinkManager.h"

CommonServantPrxBrokerCallback::CommonServantPrxBrokerCallback(tars::TarsCurrentPtr current, ClientContext context, gamoosim::ABCPack req)
{
    _current = current;
    _context = context;
    _req = req;
}

void CommonServantPrxBrokerCallback::callback_request(tars::Int32 ret, const gamoosim::ABCPack &resp)
{
    DEBUG("rpc success context:"<<_context.toJsonString()<<" req:"<<_req.toJsonString()<<" resp:"<<resp.toJsonString());
    //send to client

}
void CommonServantPrxBrokerCallback::callback_request_exception(tars::Int32 ret)
{
    
    DEBUG("rpc exception context:"<<_context.toJsonString()<<" req:"<<_req.toJsonString());

}



UserServantPrxBrokerCallback::UserServantPrxBrokerCallback(tars::TarsCurrentPtr current, ClientContext context, gamoosim::LoginReq req)
{
    
}

void UserServantPrxBrokerCallbackUserServantPrxBrokerCallback::callback_auth(tars::Int32 ret, const std::string &resp)
{
    if (ret == 0)
    {
        
    }
    
//    struct ClientContext
//    {
//        0 require string    clientId;
//        1 require short        ptclVersion;
//        2 optional long     uid;
//        3 optional string   brokerId;
//    };
    gamoosim::ClientContext context;
    context.clientId = _req.clientId;
    context.uid = _current->getUId(0);
    context.brokerId = ;
    context.ptclVersion = _req.ptclVersion;
    
    LonglinkManager.getInstance()->();
}

void UserServantPrxBrokerCallbackUserServantPrxBrokerCallback::callback_auth_exception(tars::Int32 ret)
{
    
}
